package com.asset.dispoal.business.bsAssetInstitutionBatch.service.commom;

import com.asset.dispoal.business.bsAssetInstitutionBatch.domain.db.entity.BsAssetInstitutionBatch;
import com.asset.dispoal.business.bsAssetInstitutionBatch.domain.db.mapper.BsAssetInstitutionBatchMapper;
import com.asset.dispoal.business.bsAssetInstitutionBatch.dto.BsAssetInstitutionPolicyRequest;
import com.asset.dispoal.business.bsAssetInstitutionBatch.service.converter.BsAssetInstitutionBatchConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import tech.mhuang.pacebox.core.ddd.BaseCommand;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * @author: yf
 * @date: 2022-08-17 10:12:27
 */
@Component
public class PolicyInsertCommand implements BaseCommand<BsAssetInstitutionPolicyRequest, Result> {
    @Autowired
    BsAssetInstitutionBatchMapper bsAssetInstitutionBatchMapper;

    @Override
    public Result execute(BsAssetInstitutionPolicyRequest request) {
        final BsAssetInstitutionBatch assetInstitutionBatch = BsAssetInstitutionBatchConverter.INSTANCE.resToDOPo(request);
        bsAssetInstitutionBatchMapper.update(assetInstitutionBatch);
        return Result.ok();
    }
}
